<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="created" content="2018-10-23T06:18:10.521000000">
    <meta name="changed" content="2021-05-21T06:18:42.262000000">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Language" content="en">
    <title>
      Keyboard
    </title>
    <link rel="stylesheet" type="text/css" href="../../style.css">
  </head>
  <body>
    <div class="maindiv">
      <h1>
        <img class="iconlibs" src="../../../../icons/6464/keyboard.png" alt="#########" width="32" height="32" align="middle"> <em>Keyboard</em>
      </h1>
      <table>
        <tbody>
          <tr>
            <td>
              <strong>Library:</strong>
            </td>
            <td>
              <a href="index.html">Input/Output</a>
            </td>
          </tr>
          <tr>
            <td>
              <strong>Introduced:</strong>
            </td>
            <td>
              2.2.0
            </td>
          </tr>
          <tr>
            <td valign="top">
              <strong>Appearance:</strong>
            </td>
            <td valign="top">
              <img class="appearancelibslarge" src="../../../../img-libs/keyboard.png" alt="#########" width="128" height="64">
            </td>
          </tr>
        </tbody>
      </table>
      <h2>
        Behavior
      </h2>
      <p>
        This component allows the circuit to read keys typed from the keyboard - as long as the keys are representable in the 7-bit ASCII code. After clicking the component using the poke tool, the user can type characters, which accumulate in a buffer. At all times, the ASCII value for the leftmost character in the buffer is sent out the rightmost output. When the clock input is triggered, the leftmost character disappears from the buffer and the new leftmost character is sent on the rightmost output.
      </p>
      <p>
        The supported characters for the buffer include all the printable ASCII characters, as well as space, newline, backspace, and control-L. In addition, the left-arrow and right-arrow keys move the cursor within the buffer, and the delete key deletes the character to the right of the cursor (if any).
      </p>
      <p>
        The component is asynchronous in the sense that when the buffer is empty and the user types a character, that character is sent immediately as an output, without any wait for a clock pulse.
      </p>
      <h2>
        Pins
      </h2>
      <dl>
        <dt>
          West edge, marked by a triangle (input, bit width 1)
        </dt>
        <dd>
          Clock - when triggered while the read-enable pin isn't 0, the leftmost character from the buffer is deleted, and the outputs are updated to reflect the buffer's new status.
        </dd>
        <dt>
          South edge, leftmost pin (input, bit width 1)
        </dt>
        <dd>
          Read Enable - when 1 (or floating or error), a clock edge will consume the leftmost character from the buffer. The clock input is ignored when Read Enable is 0.
        </dd>
        <dt>
          South edge, second pin from left (input, bit width 1)
        </dt>
        <dd>
          Clear - when 1, the buffer is emptied and does not accept further characters.
        </dd>
        <dt>
          South edge, second pin from right (output, bit width 1)
        </dt>
        <dd>
          Available - this is 1 when the buffer contains at least one character and 0 when the buffer is empty.
        </dd>
        <dt>
          South edge, rightmost pin (output, bit width 7)
        </dt>
        <dd>
          Data - the 7-bit ASCII code for the leftmost character in the buffer, or 0 if the buffer is empty.
        </dd>
      </dl>
      <h2>
        Attributes
      </h2>
      <dl>
        <dt>
          Buffer Length
        </dt>
        <dd>
          The number of characters that the buffer can hold at once.
        </dd>
        <dt>
          Trigger
        </dt>
        <dd>
          If the value is <q>Rising Edge,</q> then when the clock input changes from 0 to 1, the leftmost character is consumed (when enabled by the Read Enable input). If it is <q>Falling Edge,</q>, then this happens when the clock input changes from 1 to 0.
        </dd>
      </dl>
      <h2>
        Poke Tool Behavior
      </h2>
      <p>
        Pressing the mouse button into the component gives keyboard focus to the component, and a vertical-bar cursor will be displayed.
      </p>
      <p>
        Each character typed will then be inserted into the buffer, as long as the buffer hasn't reached its capacity and the character is one of those that the component supports: the printable characters within the 7-bit ASCII code, as well as space, backspace, newline, and control-L. Additionally, the user may type the left-arrow and right-arrow keys to change the location of the cursor within the buffer, and the user may type the delete key to delete the buffer character (if any) just to the right of the cursor.
      </p>
      <h2>
        Text Tool Behavior
      </h2>
      <p>
        None.
      </p>
      <p>
        <a href="../index.html">Back to <em>Library Reference</em></a>
      </p>
    </div>
  </body>
</html>
